<template>
	<view class="content">
		<!-- 顶部轮播图 -->
		<view class="banner">
			<u-swiper :list="bannerList" 
				keyName="url"
				showTitle
				:indicator="indicator" 
				indicatorMode="dot" 
				:circular="circular">
			</u-swiper>
		</view>
		<!-- end -->
		
		<!-- 模块菜单 -->
		<view class="cate-list">
			<u-grid :border="false" col="4" @click="jumpUlr">
				<u-grid-item
						v-for="(listItem,listIndex) in list"
						:key="listIndex"
				>
					<u-icon
							:customStyle="{paddingTop:20+'rpx'}"
							:name="listItem.name"
							:size="50"
					></u-icon>
					<text class="grid-text">{{listItem.title}}</text>
				</u-grid-item>
			</u-grid>
			<u-toast ref="uToast" />
		</view>
		<!-- end -->
		
		<!-- 滚动通知 -->
		<view class="notice">
			<u-notice-bar :text="notice.text" :url="notice.url" color="" bgColor="" speed="50"></u-notice-bar>
		</view>
		<!-- end -->
		
		<!-- 倒计时 -->
		<view class="djs">
			<view class="djs-bg">
				<view class="djs-title">除夕</view>
				<view class="djs-bottom">
					<view class="djs-title-d">距离2024年除夕还有</view>
					<view class="djs-number">
						<view class="sj-title">{{days}}</view>
						<view class="sj-d">天</view>
						<view class="sj-title">{{hours}}</view>
						<view class="sj-d">时</view>
						<view class="sj-title">{{minutes}}</view>
						<view class="sj-d">分</view>
						<view class="sj-title">{{seconds}}</view>
						<view class="sj-d">秒</view>
					</view>
				</view>
			</view>
		</view>
		<!-- end -->
		
		<!-- 产品列表 -->
		
		<!-- end -->
		
		<!-- 底部菜单栏 -->
		<view class="footer-meun">
			<u-tabbar
				:value="value1"
				@change="footerChange"
				:fixed="true"
				:placeholder="true"
				activeColor="#d81e06"
				:safeAreaInsetBottom="true"
			>
				<u-tabbar-item text="首页" icon="home" ></u-tabbar-item>
				<u-tabbar-item text="咨询" icon="coupon" ></u-tabbar-item>
				<u-tabbar-item text="商城" icon="gift" ></u-tabbar-item>
				<u-tabbar-item text="我的" icon="account" ></u-tabbar-item>
			</u-tabbar>
		</view>
		<!-- end -->
	</view>
</template>

<script >
	export default {
		data() {
			return {
				title: 'Hello',
				bannerList: [{
					url: '/static/banner/banner1.png',
					title: '昨夜星辰昨夜风，画楼西畔桂堂东',
				},{
					url: '/static/banner/banner2.png',
					title: '身无彩凤双飞翼，心有灵犀一点通',
				},{
					url: '/static/banner/banner3.png',
					title: '谁念西风独自凉，萧萧黄叶闭疏窗，沉思往事立残阳',
				},{
					url: '/static/banner/banner4.png',
					title: '谁念西风独自凉，萧萧黄叶闭疏窗，沉思往事立残阳',
				},{
					url: '/static/banner/banner6.png',
					title: '谁念西风独自凉，萧萧黄叶闭疏窗，沉思往事立残阳',
				}],
				indicator:true,
				circular:true,
				value1: 0,
				list: [{
                    name: '/static/icon/denglong5.png',
                    title: '节日介绍',
					url: '/pages/festival/index',
                },{
					name: '/static/icon/denglong3.png',
					title: '活动推荐',
					url: '/pages/activity/index'
				},{
					name: '/static/icon/denglong9.png',
					title: '在线庆祝',
					url: '/pages/celebrate/index'
				},{
					name: '/static/icon/denglong.png',
					title: '社区交流',
					url: '/pages/community/index'
				},{
					name: '/static/icon/denglong-fc.png',
					title: '日历提醒',
					url: '/pages/remind/index'
				},{
					name: '/static/icon/denglong-fc.png',
					title: '健康祝福',
					url: '/pages/blessing/index'
				},{
					name: '/static/icon/denglong-fc.png',
					title: '红包福利',
					url: '/pages/welfare/index'
				},{
					name: '/static/icon/denglong-fc.png',
					title: '积分奖励',
					url: '/pages/integral/index'
				}],
				notice:{text:'财源滚滚来财源滚滚来财源滚滚来财源滚滚来财源滚滚来财源滚滚来财源滚滚来财源滚滚来',url:''},
				countdown: '',
				currentDate: new Date(),
				newYearEve: new Date('2024-02-09 00:00:00'), // 假设2024年除夕是2月9日
				days:0,
				hours:0,
				minutes:0,
				seconds:0,
			}
		},
		onLoad() {
			this.startCountdown();
		},
		methods: {
			// 底部菜单栏切换
			footerChange(name) {
				this.value1 = name
			},
			left() {
				console.log('left');
			},
			right() {
				console.log('right');
			},
			onChange(e) {
				this.timeData = e
			},
			startCountdown() {
				setInterval(() => {
					const diff = this.newYearEve - this.currentDate;
					if (diff > 0) {
						const days = Math.floor(diff / (1000 * 60 * 60 * 24));
						const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
						const minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60));
						const seconds = Math.floor((diff % (1000 * 60)) / 1000);
						this.countdown = `${days}天${hours}小时${minutes}分钟${seconds}秒`;
						this.currentDate = new Date();
						this.days = days;
						this.hours = hours;
						this.minutes = minutes;
						this.seconds = seconds;
					} else {
						this.countdown = '除夕快乐！';
					}
				}, 1000);
			},
			jumpUlr(item){
				if(this.list[item].url)
					uni.navigateTo({
						url: this.list[item].url
					});
			}
		}
	}
</script>

<style lang="scss">
	page{
		background-image: url('/static/bg/1.gif');
		background-size:100% 100%;
		background-repeat: no-repeat;
		background-position: center center;
		height: inherit;
	}
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}
	.banner{
		width: 100%;
	}
	.cate-list{
		width: 100%;
		padding-top: 30rpx;
	}
	.grid-text {
		font-size: 14px;
		color: #909399;
		padding: 10rpx 0 20rpx 0rpx;
		/* #ifndef APP-PLUS */
		box-sizing: border-box;
		/* #endif */
	}
	.notice{
		width: 98%;
	}
	.djs{
		width: 98%;
		
		.djs-bg{
			background-image: url('/static/bg/holiday_detial_bg.png');
			background-size:100% 100%;
			background-repeat: no-repeat;
			background-position: center center;
			display: flex;
			flex-direction: column;
			justify-content: space-evenly;
			align-items: flex-start;
			color: #ffffff;
			padding: 30rpx 20rpx;
			.djs-title{
				font-size: 60rpx;
				font-weight: 700;
			}
			.djs-title-d{
				font-size: 28rpx;
				padding-right: 20rpx;
			}
			.djs-bottom{
				display: flex;
				align-items: flex-end;
				flex-direction: row;
			}
			.djs-number{
				display: flex;
				.sj-title{
					font-size: 50rpx;
				}
				.sj-d{
					padding-top: 10rpx;
					font-size: 28rpx;
				}
			}
		}
	}
	
</style>
